<%@Page Language="C#"%>
<%@Import Namespace="System.IO" %>
<%@Import Namespace="System.Text" %>


<script runat="server">


	void Page_Load( object Sender, EventArgs e )
	{

		StreamWriter stream;
		
		char HiChar;
		
		HiChar = (char) 0xaaaa;

		stream = new StreamWriter( Server.MapPath("myfile.utf8"), false, System.Text.Encoding.UTF8 );	
		stream.Write( "Hello World");
		stream.Write( HiChar );
		stream.Close();
		
		stream = new StreamWriter( Server.MapPath("myfile.utf7"), false, System.Text.Encoding.UTF7 );	
		stream.Write( "Hello World");
		stream.Write( HiChar );
		stream.Close();
		
		stream = new StreamWriter( Server.MapPath("myfile.ascii"), false, System.Text.Encoding.ASCII );	
		stream.Write( "Hello World");
		stream.Write( HiChar );
		stream.Close();

		stream = new StreamWriter( Server.MapPath("myfile.unicode"), false, System.Text.Encoding.Unicode );	
		stream.Write( "Hello World");
		stream.Write( HiChar );
		stream.Close();

		StreamReader reader;
		
		reader = new StreamReader(Server.MapPath("myfile.unicode"),
							      System.Text.Encoding.UTF8, true, 4096 );
							      
//		Response.Write( reader.ReadLine().Length.ToString() );
		Response.Write( reader.ReadLine() );
		reader.Close();
	}

</script>